package com.ruoyi.repair.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.repair.mapper.TRepairRecordMapper;
import com.ruoyi.repair.domain.TRepairRecord;
import com.ruoyi.repair.service.ITRepairRecordService;

/**
 * 维修记录Service业务层处理
 * 
 * @author ruoyi
 * @date 2025-09-24
 */
@Service
public class TRepairRecordServiceImpl implements ITRepairRecordService 
{
    @Autowired
    private TRepairRecordMapper tRepairRecordMapper;

    /**
     * 查询维修记录
     * 
     * @param id 维修记录主键
     * @return 维修记录
     */
    @Override
    public TRepairRecord selectTRepairRecordById(Long id)
    {
        return tRepairRecordMapper.selectTRepairRecordById(id);
    }

    /**
     * 查询维修记录列表
     * 
     * @param tRepairRecord 维修记录
     * @return 维修记录
     */
    @Override
    public List<TRepairRecord> selectTRepairRecordList(TRepairRecord tRepairRecord)
    {
        return tRepairRecordMapper.selectTRepairRecordList(tRepairRecord);
    }

    /**
     * 新增维修记录
     * 
     * @param tRepairRecord 维修记录
     * @return 结果
     */
    @Override
    public int insertTRepairRecord(TRepairRecord tRepairRecord)
    {
        return tRepairRecordMapper.insertTRepairRecord(tRepairRecord);
    }

    /**
     * 修改维修记录
     * 
     * @param tRepairRecord 维修记录
     * @return 结果
     */
    @Override
    public int updateTRepairRecord(TRepairRecord tRepairRecord)
    {
        return tRepairRecordMapper.updateTRepairRecord(tRepairRecord);
    }

    /**
     * 批量删除维修记录
     * 
     * @param ids 需要删除的维修记录主键
     * @return 结果
     */
    @Override
    public int deleteTRepairRecordByIds(Long[] ids)
    {
        return tRepairRecordMapper.deleteTRepairRecordByIds(ids);
    }

    /**
     * 删除维修记录信息
     * 
     * @param id 维修记录主键
     * @return 结果
     */
    @Override
    public int deleteTRepairRecordById(Long id)
    {
        return tRepairRecordMapper.deleteTRepairRecordById(id);
    }

    /**
     * 根据资产编号查询维修履历
     * 
     * @param assetNo 资产编号
     * @param startDate 开始日期
     * @param endDate 结束日期
     * @return 维修履历列表
     */
    @Override
    public List<TRepairRecord> selectRepairHistoryByAsset(String assetNo, String startDate, String endDate)
    {
        return tRepairRecordMapper.selectRepairHistoryByAsset(assetNo, startDate, endDate);
    }

    /**
     * 根据维修单号查询完整维修履历（包含报修信息）
     * 
     * @param workNo 维修单号
     * @return 完整维修履历列表
     */
    @Override
    public List<Object> selectCompleteRepairHistoryByWorkNo(String workNo)
    {
        return tRepairRecordMapper.selectCompleteRepairHistoryByWorkNo(workNo);
    }

    /**
     * 根据资产编号查询完整维修履历（包含报修和维修单信息，即使没有维修记录）
     * 
     * @param assetNo 资产编号
     * @param startDate 开始日期
     * @param endDate 结束日期
     * @return 完整维修履历列表
     */
    @Override
    public List<Object> selectCompleteRepairHistoryByAsset(String assetNo, String startDate, String endDate)
    {
        return tRepairRecordMapper.selectCompleteRepairHistoryByAsset(assetNo, startDate, endDate);
    }
}